def singleton(cls):
    print("step1")

    def inner(*args, **kwargs):
        print("step2")
        if hasattr(cls, "__instance"):
            return getattr(cls, "__instance")
        obj = cls(*args, **kwargs)
        setattr(cls, "__instance", obj)
        return obj

    return inner


@singleton
class Person:
    pass


p1 = Person()
p2 = Person()
print(p1 is p2)
